import pkg_resources
from PyInstaller.utils.hooks import collect_data_files, collect_dynamic_libs, get_package_paths
installed_packages = []
for d in pkg_resources.working_set:
    top_level_path=d.location+'\\'+d.egg_name()[:-7]+'.dist-info\\top_level.txt'
    if os.path.exists(top_level_path):
        with open(top_level_path,'r',encoding='utf-8') as f:
            pkg_name=f.read().strip()
    else:
        pkg_name=d.project_name
    installed_packages.append(pkg_name)
# 排除一些常见的开发工具
excluded_packages = ['pip', 'setuptools', 'wheel']
hiddenimports = [pkg for pkg in installed_packages if pkg not in excluded_packages]
# -*- mode: python ; coding: utf-8 -*-
#hiddenimports = [
#    'src.backend.*',
#    'src.forward.*',
#    'pandas'
#]
current_file_abspath=os.path.abspath(__name__)
a = Analysis(
    ['main.py'],
    pathex=[],
    binaries=[],
    datas=[
        (r'D:\ai\projects\python\teacher-helper\src', 'src'),
    ],
    hiddenimports=hiddenimports,
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
    optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='帮帮',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon='help.jpeg'
)
